import java.awt.Color;
import java.awt.Shape;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;


public class RectangleCharacter implements GameObject {

	
	double x = 0.0;
	double y = 0.0;
	Color c;
	int r;
	double rot = 0.0;
	@Override
	public void actionPerformed(ActionEvent e) {
		r += 10;
		r %= 256;
		rot += .02;
	}

	@Override
	public void keyPressed(KeyEvent e) {
		if(e.getKeyCode() == KeyEvent.VK_UP){
			y-=5;
		}
		if(e.getKeyCode() == KeyEvent.VK_DOWN){
			y+=5;
		}
		if(e.getKeyCode() == KeyEvent.VK_RIGHT){
			x+=5;
		}
		if(e.getKeyCode() == KeyEvent.VK_LEFT){
			x-=5;
		}
	}

	@Override
	public void keyReleased(KeyEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void keyTyped(KeyEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public Shape getShape() {
		// TODO Auto-generated method stub
		return new Rectangle2D.Double(x, y, 100, 100);
	}

	@Override
	public Color getColor() {
		// TODO Auto-generated method stub
		return new Color(r, 255-r, 255-r);
	}

	@Override
	public double getx() {

		return x;
	}

	@Override
	public double gety() {
		// TODO Auto-generated method stub
		return y;
	}

	@Override
	public AffineTransform getTransform() {
		return AffineTransform.getRotateInstance(rot, x, y);
	}

}
